# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-terminal-table
_gemname=terminal-table
# NOTE: Before bumping, check version required by jekyll.
pkgver=3.0.2
pkgrel=3
pkgdesc="Ruby ASCII Table Generator, simple and feature rich"
url="https://github.com/tj/terminal-table"
arch="noarch"
license="MIT"
depends="ruby ruby-unicode-display_width"
checkdepends="ruby-rspec"
source="https://github.com/tj/terminal-table/archive/v$pkgver/$_gemname-$pkgver.tar.gz
	gemspec.patch
	"
builddir="$srcdir/$_gemname-$pkgver"
options="!check"  # FIXME: tests require extra dependency: term-ansicolor

build() {
	gem build $_gemname.gemspec
}

check() {
	rspec .
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	# Remove unnecessary files and rubbish...
	cd "$gemdir"
	rm -r cache build_info doc extensions
}

sha512sums="
5e8aa375fb1a5d2789ac0a735e5b5420261700b91650658e2b084bc9544cc195a1af329d157626b6aa4e738ad59a860245da15a099940ba68bbe0e937fd2574d  terminal-table-3.0.2.tar.gz
0539565d0a8d0e21d06ae2c5a9551ae46da6743e50543fd928da64c222181efd1b656bedcc2cbf691703fbeb06c0ffaf5cf169a7f5f91b8f9f6bb788669940fc  gemspec.patch
"
